package org.jeecg.modules.complain.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.complain.entity.BaseCustomer;
import org.jeecg.modules.complain.entity.Repair;
import org.jeecg.modules.complain.entity.RepairConfig;
import org.jeecg.modules.complain.mapper.RepairMapper;
import org.jeecg.modules.complain.service.IRepairService;
import org.jeecg.modules.complain.vo.RepairReport;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 报修处理
 * @Author: jeecg-boot
 * @Date:   2019-07-29
 * @Version: V1.0
 */
@Service
public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> implements IRepairService {

     @Autowired
     private RepairMapper repairMapper;

    @Override
    public Repair selectRepairDetail(String repairId) {
        return repairMapper.selectRepairDetail(repairId);
    }

    @Override
    public BaseCustomer selectByRoomId(String roomId) {
        return repairMapper.selectByRoomId(roomId);
    }



    @Override
    public RepairConfig selectConfigByDepartId(String departId) {
        return repairMapper.selectConfigByDepartId(departId);
    }


    @Override
    public Repair selectById(String id,String status) {
        return repairMapper.selectById(id,status);
    }

    @Override
    public List<Repair>  selectByStatus(String status) {
        return repairMapper.selectByStatus(status);
    }

    @Override
    public Integer updateRepairStatus(String repairId, Integer status) {
        return repairMapper.updateRepairStatus(repairId,status);
    }

    @Override
    public SysUser selectByUserId(String handId) {
        return  repairMapper.selectPhoneByUserId(handId);
    }

    @Override
    public RepairReport getRepairReport(String projectId) {
        int total = repairMapper.getTotalByProjectId(projectId);
        int completeNum = repairMapper.getCompleteByProjectId(projectId);
        RepairReport repairReport = new RepairReport();
        repairReport.setTotal(total);
        repairReport.setCompleteNum(completeNum);
        return repairReport;
    }

    @Override
    public Repair selectByIds(String repairId) {
        return repairMapper.selectByIds(repairId);
    }

    @Override
    public String findRoomInfo(String roomId) {
        return repairMapper.findRoomInfo(roomId);
    }

    @Override
    public String selectProjectName(String projectId) {
        return repairMapper.selectProjectName(projectId);
    }

    @Override
    public String selectFloor(String roomId) {
        return repairMapper.selectFloor(roomId);
    }

    @Override
    public List<Repair> selectRepairExport(Repair repair) {
        return repairMapper.selectRepairExport(repair);
    }


}
